import java.util.*;

public class Poke {
    static Map<Integer,String> pokes = new HashMap<Integer,String>();
    public static void main(String[] args) {

        List<String> type = new ArrayList<String>();
        List<String> num = new ArrayList<String>();
        type.add("♥");
        type.add("♠");
        type.add("♣");
        type.add("♦");

        for (int i = 3; i < 11; i++) {
            num.add(i + "");
        }
        num.add("J");
        num.add("Q");
        num.add("K");
        num.add("A");
        num.add("2");

        // 拼装 牌库

        List<Integer> keys = new ArrayList<>();
        int key = 0;
        for (String s : num) {
            for (String string : type) {
                keys.add(key);
                pokes.put(key++, s+string);
            }
        }
        pokes.put(52,"小王");
        pokes.put(53,"大王");
        keys.add(52);
        keys.add(53);

        // 洗牌
        Collections.shuffle(keys);

        // 发牌
        TreeSet<Integer> key1 = new TreeSet<>();
        TreeSet<Integer> key2 = new TreeSet<>();
        TreeSet<Integer> key3 = new TreeSet<>();
        TreeSet<Integer> key4 = new TreeSet<>();
        for (int i = 0; i < keys.size(); i++) {
            if(i > 50){
                key4.add(keys.get(i));
                continue;
            }
            if(i%3==0){
                key1.add(keys.get(i));
            }
            else if(i%3==1){
                key2.add(keys.get(i));
            } else if (i%3==2) {
                key3.add(keys.get(i));
            }
        }
        look("player1",key1);
        look("player2",key2);
        look("player3",key3);
        look("剩余牌",key4);
    }
    public static void look(String name,TreeSet<Integer> keys){
        System.out.println(name);
        for (Integer key : keys) {
            System.out.print(pokes.get(key)+"     ");
        }
        System.out.println();
    }
}
